<?php

use Illuminate\Routing\Router;

Admin::routes();

Route::group([
    'prefix'        => config('admin.route.prefix'),
    'namespace'     => config('admin.route.namespace'),
    'middleware'    => config('admin.route.middleware'),
    'as'            => config('admin.route.prefix') . '.',
], function (Router $router) {

    $router->get('/', 'HomeController@index')->name('home');

    $router->resource('group', GroupController::class);
    $router->resource('levels', LevelController::class);
    $router->resource('matches', MatchController::class);
    $router->resource('sport_types', SportTypeController::class);


    // api
    $router->get('api/group', 'GroupController@list');
    $router->get('api/level', 'LevelController@list');
    $router->get('api/sport_types', 'SportTypeController@list');

});

// 小程序路由
Route::group([
    'prefix'        => 'applet',
    'namespace'     => 'App\\Applet\\Controllers',
    'middleware'    => [],
    'as'            => 'applet.',
], function (Router $router) {

    // IndexController
    $router->get('hotMatches', 'IndexController@hotMatches'); // 首页热门比赛
    $router->get('matchesDetail', 'IndexController@matchesDetail'); // 活动详情

    // UserController
    $router->post('login', 'UserController@login'); // 登录
    $router->post('openIdLogin', 'UserController@openIdLogin'); // openid登录
    $router->post('regist', 'UserController@regist'); // 注册
    $router->post('getPhone', 'UserController@getPhone'); // 小程序获取手机号
    $router->get('makeUser', 'UserController@makeUser'); // 制作用户

    // MatchController
    $router->get('reportUsersList', 'MatchController@reportUsersList');// 报名用户列表
    $router->get('makeStage', 'MatchController@makeStage');// 报名用户列表
    $router->get('getMyStage', 'MatchController@getMyStage');// 报名用户列表
    
    Route::group([
        'middleware'    => [],
    ], function (Router $router) {
        $router->get('getInfo', 'UserController@getInfo');// 获取用户信息
        $router->post('reportMatch', 'UserController@reportMatch'); // 报名比赛
    });

});

// 需要登录的小程序路由